package com.example.service.impl;

import com.example.Utils.ImageToBase64Str;
import com.example.model.SelectiveProducts;
import com.example.dao.SelectiveProductsMapper;
import com.example.service.ISelectiveProductsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Hello
 * @since 2024-07-09
 */
@Service
public class SelectiveProductsServiceImpl extends ServiceImpl<SelectiveProductsMapper, SelectiveProducts> implements ISelectiveProductsService {
    @Autowired
    SelectiveProductsMapper selectiveProductsMapper;
    ImageToBase64Str imageToBase64Str;
    public List<String> getAllImages(){
        List<String> ImagesList = selectiveProductsMapper.getAllImages();
        for(String imageStr:ImagesList){
            ImagesList.remove(imageStr);
            String imageName=imageStr.substring(imageStr.lastIndexOf("/")+1);
            imageName="../../images/selectiveMenu/"+imageName+".png";
            ImagesList.add(imageName);
        }
       System.out.println(ImagesList);
        return ImagesList;
    }
}
